package com.tanhua.admin.task;

import com.tanhua.admin.service.AnalysisService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

/**
 * @auther : 白月尘
 * @date : 13:45  2021/10/28
 */
@Component
public class AnalysisTask {
    @Autowired
    private AnalysisService analysisService;

    //"0 0 24/6 * * ? *" 每天六点
    //0 0 8 * * ?     八点
    //0 0/10 * * * ?  十分钟
    //0/5 * * * * ?  五秒
    @Scheduled(cron = "0 0/10 * * * ?")
    public void analysis(){
        try {
            analysisService.analysis();
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
    @Scheduled(cron = "0 0 0 1/1 * ? ")
    public void deleteAnalysis(){
        try {
            analysisService.deleteAnalysis();
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}
